Blog

Polymorphism and yarn crafts

November 24, 20195 min read

There are multiple different crafts, such as knitting, weaving, or crocheting, in which you could create a fabric. Regardless of which craft you choose, you want to do the same thing: create fabric. If we were to model that programmatically, we would take advantage of polymorphism.

Inheritance and gardening

November 20, 20193 min read

Inheritance supports reusability in programming. To write an application that prints a plant's care instruction cards for the garden center, we can use inheritance to share the code that prints the instructions.

Abstraction and remote controls

November 18, 20193 min read

Using a remote control for your TV is an abstraction. You push a button and a thing happens. And you only have a few buttons to choose from.

Encapsulation and horses

November 16, 20192 min read

The first principle of object-oriented programming is encapsulation. Encapsulation is when you "hide" an object's state from other objects.

Trees and Harry Potter's Triwizard tournament

November 15, 20196 min read

If you're a big Harry Potter fan, you probably enjoyed the Triwizard Maze. When racing through the maze, the competitors were faced with decisions about which path to take. Modeling these choices can be done using a tree data structure.

Queues and lunch lines

November 05, 20193 min read

Waiting in a line—or as the British call it, “queueing”—is a literal visualization of a queue data structure. The first person in line is the first person who gets whatever they’re waiting for and leaves the line.

Stacks and PEZ dispensers

November 03, 20193 min read

When you fill a PEZ dispenser, you push the candy from the top down. When you eat the candy, you pop a piece off the top of the literal stack of pieces. A stack data structure behaves the same way.

Linked lists and scavenger hunts

October 26, 20195 min read

A scavenger hunt is a physical representation of a linked list. A linked list is a data structure characterized by sequential data access and no random access.

Recursion and Russian nesting dolls

October 25, 20194 min read

Recursion has a reputation in computer science of being intimidating but what is it exactly? Russian nesting dolls are a great metaphor for recursion so let's use them as an example to break it down in an easy-to-understand way.

Set theory and cute Instagram accounts

October 19, 20194 min read

Venn diagrams are a great way to think about set theory. In this post, we'll use Venn diagrams to see how our Instagram feed would change based on various set theory operations.